﻿using Application.Interfaces.Email;
using System.Net.Mail;

namespace Infrastructure.Implementations.Email
{
    public class SmtpEmailSender : IEmailSender
    {
        public void SendEmail(string subject, string body, string fromAddress, string fromName, string toAddress, string toName)
        {
            var message = new MailMessage();
            message.From = new MailAddress(fromAddress, fromName);
            message.To.Add(new MailAddress(toAddress, toName));
            message.Subject = subject;
            message.Body = body;
            message.IsBodyHtml = true;
            using (var smtpClient = new SmtpClient())
            {
                smtpClient.Send(message);
            }
        }
    }
}